package cn.marinda.resturants.mapper;

import cn.marinda.resturants.entity.Activity;
import cn.marinda.resturants.entity.Administrator;
import cn.marinda.resturants.global.Pages;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.context.annotation.Primary;

import java.util.List;

/** 管理员mapper
 * @date 2021/11/16
 * @author Marinda
 */
public interface AdministratorMapper extends BaseMapper<Administrator> {


    /** 分页
     *
     * @param pages 分页
     * @return 分页结果
     */
    @Select("select * from r_administrator")
    IPage<Administrator> selectAdministratorPages(Pages<?> pages);

    /** 查询一个身份类型下的所有管理员
     *
     * @param type 类型
     * @return 包含administrator 的一个集合
     */
    @Select("select * from r_administrator where type = #{type}")
    List<Administrator> selectTypeAdmin(String type);

    /** 通过查询管理员名字找到这个Admin
     *
     * @param name adminName
     * @return Administrator
     */
    @Select("select * from r_administrator where name = #{name}")
    Administrator selectAdminName(String name);

    /** 通过查询Administrator的Phone能找到这个Administator
     *
     * @param phone admin phone
     * @return Administrator
     */
    @Select("select * from r_administrator where phone = #{phone}")
    Administrator selectPhone(String phone);


}
